# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.DisplayVideo.V1.Model.InsertionOrderBudgetSegment do
  @moduledoc """
  Settings that control the budget of a single budget segment.

  ## Attributes

  *   `budgetAmountMicros` (*type:* `String.t`, *default:* `nil`) - Required. The budget amount the insertion order will spend for the given date_range. The amount is in micros. Must be greater than 0. For example, 500000000 represents 500 standard units of the currency.
  *   `campaignBudgetId` (*type:* `String.t`, *default:* `nil`) - The budget_id of the campaign budget that this insertion order budget segment is a part of.
  *   `dateRange` (*type:* `GoogleApi.DisplayVideo.V1.Model.DateRange.t`, *default:* `nil`) - Required. The start and end date settings of the budget segment. They are resolved relative to the parent advertiser's time zone. * When creating a new budget segment, both `start_date` and `end_date` must be in the future. * An existing budget segment with a `start_date` in the past has a mutable `end_date` but an immutable `start_date`. * `end_date` must be the `start_date` or later, both before the year 2037.
  *   `description` (*type:* `String.t`, *default:* `nil`) - The budget segment description. It can be used to enter Purchase Order information for each budget segment and have that information printed on the invoices. Must be UTF-8 encoded.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :budgetAmountMicros => String.t() | nil,
          :campaignBudgetId => String.t() | nil,
          :dateRange => GoogleApi.DisplayVideo.V1.Model.DateRange.t() | nil,
          :description => String.t() | nil
        }

  field(:budgetAmountMicros)
  field(:campaignBudgetId)
  field(:dateRange, as: GoogleApi.DisplayVideo.V1.Model.DateRange)
  field(:description)
end

defimpl Poison.Decoder, for: GoogleApi.DisplayVideo.V1.Model.InsertionOrderBudgetSegment do
  def decode(value, options) do
    GoogleApi.DisplayVideo.V1.Model.InsertionOrderBudgetSegment.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.DisplayVideo.V1.Model.InsertionOrderBudgetSegment do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
